{template 'common/header'}
<ul class="nav nav-tabs">
	<li class="active"><a href="{url 'platform/reply' array('m' => $m)}">管理{$module['title']}</a></li>
	<li><a href="{url 'platform/reply/post' array('m' => $m)}"><i class="fa fa-plus"></i> 添加{$module['title']}</a></li>
</ul>
<div class="clearfix">
	<div class="panel panel-info">
		<div class="panel-heading">筛选</div>
		<div class="panel-body">
			<form action="./index.php" method="get" class="form-horizontal" role="form">
			<input type="hidden" name="c" value="platform">
			<input type="hidden" name="a" value="reply">
			<input type="hidden" name="m" value="{$_GPC['m']}" />
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">状态</label>
					<div class="col-sm-8">
						<select name="status" class="form-control">
							<option value="-1" {if $_GPC['status'] == '-1'} selected{/if}>所有</option>
							<option value="1" {if $_GPC['status'] == '1'} selected{/if}>启用</option>
							<option value="0" {if $_GPC['status'] == '0'} selected{/if}>禁用</option>
						</select>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">关键字</label>
					<div class="col-sm-8">
							<input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}">
					</div>
					<div class="pull-right col-xs-12 col-sm-2 col-lg-1">
						<button class="btn btn-block"><i class="fa fa-search"></i> 搜索</button>
					</div>
				</div>
			</form>
		</div>
	</div>

	<div>
		{loop $replies $row}
		<div {if $row['status'] == '0'}class="panel panel-danger"{else}class="panel panel-default"{/if}>
			<div class="panel-heading clearfix">
				{$row['name']}
				{if $row['displayorder'] > 0}
					{if $row['displayorder'] == '255'}
						<span class="label label-primary">置顶</span>
					{else}
						<span class="label label-info">优先级 {$row['displayorder']}</span>
					{/if}
				{/if}
				{if $row['status'] == '0'}<span class="label label-danger">已禁用</span>{/if}
			</div>
			<div class="panel-body">
				{loop $row['keywords'] $kw}
				<span class="label label-default">{$kw['content']}</span>
				{if $kw['type'] == 4}<span class="label label-info">优先级在{$row['displayorder']}之下直接生效</span>{/if}
				{/loop}
			</div>
			<div class="panel-footer clearfix">
				<div class="btn-group pull-right">
					<a class="btn btn-default btn-xs" href="{php echo url('platform/reply/post', array('m' => $m, 'rid' => $row['id']))}"><i class="fa fa-edit"></i> 编辑</a>
					<a class="btn btn-default btn-xs" href="{php echo url('platform/reply/delete', array('m' => $m, 'rid' => $row['id']))}" onclick="return confirm('删除规则将同时删除关键字与回复，确认吗？');return false;"><i class="fa fa-times"></i> 删除</a>
					<a class="btn btn-default btn-xs" href="{php echo url('platform/stat/trend', array('id' => $row['id']))}">使用率走势</a>
					{if $row['options']}
					<div class="btn-group">
						<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
							功能选项
							<span class="caret"></span>
						</button>
						<ul class="dropdown-menu">
							{loop $row['options'] $opt}
								<li><a href="{$opt['link']}">{$opt['title']}</a></li>
							{/loop}
						</ul>
					</div>
					{/if}
				</div>
			</div>
		</div>
		{/loop}
	</div>
	{$pager}
</div>
{template 'common/footer'}
